﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.IO;
using InSTEDD.Labs.Geo.Locators;

namespace InSTEDD.Labs.Geo.Tests
{
	[TestFixture]
	public class CountryLocatorFixture
	{
		[Test]
		public void ShouldLoadFileWithCountryAreas()
		{
			CountryLocator loc =  CountryLocator.FromFile(@"Country_Borders\Country_Borders.txt");

			Assert.AreEqual(250,loc.Countries.Count);

		}

		[Test]
		public void ShouldReturnCountryForPoint()
		{
			CountryLocator loc = CountryLocator.FromFile(@"Country_Borders\Country_Borders.txt");
			PPoint test = new PPoint(-120,38);
			Country c = loc.GetCountryForPoint(test);
			Assert.IsNotNull(c);
			Assert.AreEqual("United States", c.Name);
		}

		[Test]
		public void ShouldReturnNullForNonLand()
		{
			CountryLocator loc = CountryLocator.FromFile(@"Country_Borders\Country_Borders.txt");
			PPoint test = new PPoint(-125, 38);
			Country c = loc.GetCountryForPoint(test);
			Assert.IsNull(c);
		}
	}
}
